# -*- coding:utf-8 -*-
"""
@File       :   二分不等于的情况.py
@Author     :   LINING
@Time       :   2024/2/29 15:13
@Description :   找到第一个大于目标的下标
"""

a = [1,2,3,5,7,9,11,13,15,17,19]
b = 1


def get_index(target, target_list):
    left = 0
    right = len(target_list)-1
    while left+1 < right:
        mid = int((left+right)/2)
        # 小于等于不是答案可以排掉
        if target_list[mid] <= target:
            left = mid
        # 大于可能是答案要保留
        else:
            right = mid
    for i in [left, right]:
        if target_list[i] > target:
            return target_list[i]


print(get_index(b, a))

